#pragma once

#include "framework.h"
#include "resource.h"

INT_PTR CALLBACK ClientProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

class Client
{
public:
	VOID Init(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	INT_PTR Create(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	INT_PTR fd_read(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	INT_PTR fd_write(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	INT_PTR fd_close(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

	INT_PTR fd_connect(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	INT_PTR wm_socket_notify(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

	INT_PTR idcancel(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	INT_PTR idc_button_send(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
private:
	HWND hEdit;
	HWND hEditSend;
	SOCKET m_socket;
	struct sockaddr_in m_addr;
	char szIPAddr[32] = { "127.0.0.1" };
	int iPort = 8888;
};